#include <stdio.h>


int main()
{
	int N;
	scanf("%d",&N);
	int n;
	int i;
	int ch[100]={0};
	int count=0;
	int sum=0;
	while(N!=0)
	{
		sum=0;
		count++;
		if(count<=N)
		{
			scanf("%d",&n);
			for(i=0;i<n;i++)
			{
				scanf("%d",&ch[i]);
				sum+=ch[i];
			}
			printf("%d\n",sum);
		}
		else
			break;
	}
	return 0;
}